package org.example.util;

import lombok.Data;

import java.io.Serializable;
// 确定返回格式（统一）
@Data
public class JsonResult<T> implements Serializable {
    private Boolean success;
    private T data;
    private Integer code;
    private String error;

    public JsonResult() {

    }

    public JsonResult(T data) {
        this.data = data;
        this.success = true;
        this.code = 200;
    }

    public JsonResult(Integer code, String error) {
        this.success = false;
        this.code = code;
        this.error = error;
    }
}
